﻿

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GenerateCode_GEBrilliantFactory
{
    /// <summary>
    /// 输出参数- 生成查询实体类
    /// </summary>
    public class OutputModel_Generate : BaseGenerate
    {
        public static string CreateQueryModelLText(string Modulelogo,
            string ChinaComment, List<ColumnModel> columnNameList, string entityName)
        {
            var str = TextHelper.ReadText(@"Templete\Entity\OutputModel模板.txt");
            CommonReplace(ref str);

            str = str.Replace("$ChinaComment$", ChinaComment);//中文注释
            str = str.Replace("$EntityName$", entityName);

            str = str.Replace("$Modulelogo$", Modulelogo);//模块简写

            //处理 分页查询返回部分
            string attrString = "";
            List<ColumnModel> newColumnNameList = ListHelper.RemoveCreatedTimeUpdatedTimeCreatedUserIdCreatedUserNameUpdatedUserIdUpdatedUserName(columnNameList);
            for (int i = 0; i < newColumnNameList.Count; ++i)
            {
                attrString += StructStrHelper.GenerateAttribute(i, newColumnNameList[i]);
            }
            str = str.Replace("$QueryOutputAttributes$", attrString);

            //处理 导出返回部分
            attrString = "";
            newColumnNameList = ListHelper.RemoveIdCreateIdModifyIdDelFlag(columnNameList);
            for (int i = 0; i < newColumnNameList.Count; ++i)
            {
                attrString += StructStrHelper.GenerateAttribute(i, newColumnNameList[i], true);
            }
            str = str.Replace("$ExportOutputAttributes$", attrString);

            return str;
        }
    }
}
